package com.hiultra.archive.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.hiultra.common.annotation.Log;
import com.hiultra.common.core.controller.BaseController;
import com.hiultra.common.core.domain.AjaxResult;
import com.hiultra.common.enums.BusinessType;
import com.hiultra.archive.domain.SimfExamineItem;
import com.hiultra.archive.service.ISimfExamineItemService;
import com.hiultra.common.utils.poi.ExcelUtil;
import com.hiultra.common.core.page.TableDataInfo;

/**
 * 审批记录Controller
 * 
 * @author ruoyi
 * @date 2023-09-25
 */
@RestController
@RequestMapping("/examine/SimfExamineItem")
public class SimfExamineItemController extends BaseController
{
    @Autowired
    private ISimfExamineItemService simfExamineItemService;

    /**
     * 查询审批记录列表
     */
    @PreAuthorize("@ss.hasPermi('examine:SimfExamineItem:list')")
    @GetMapping("/list")
    public TableDataInfo list(SimfExamineItem simfExamineItem)
    {
        startPage();
        List<SimfExamineItem> list = simfExamineItemService.selectSimfExamineItemList(simfExamineItem);
        return getDataTable(list);
    }

    /**
     * 导出审批记录列表
     */
    @PreAuthorize("@ss.hasPermi('examine:SimfExamineItem:export')")
    @Log(title = "审批记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SimfExamineItem simfExamineItem)
    {
        List<SimfExamineItem> list = simfExamineItemService.selectSimfExamineItemList(simfExamineItem);
        ExcelUtil<SimfExamineItem> util = new ExcelUtil<SimfExamineItem>(SimfExamineItem.class);
        util.exportExcel(response, list, "审批记录数据");
    }

    /**
     * 获取审批记录详细信息
     */
    @PreAuthorize("@ss.hasPermi('examine:SimfExamineItem:query')")
    @GetMapping(value = "/{itemId}")
    public AjaxResult getInfo(@PathVariable("itemId") Long itemId)
    {
        return AjaxResult.success(simfExamineItemService.selectSimfExamineItemByItemId(itemId));
    }

    /**
     * 新增审批记录
     */
    @PreAuthorize("@ss.hasPermi('examine:SimfExamineItem:add')")
    @Log(title = "审批记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SimfExamineItem simfExamineItem)
    {
        return toAjax(simfExamineItemService.insertSimfExamineItem(simfExamineItem));
    }

    /**
     * 修改审批记录
     */
    @PreAuthorize("@ss.hasPermi('examine:SimfExamineItem:edit')")
    @Log(title = "审批记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SimfExamineItem simfExamineItem)
    {
        return toAjax(simfExamineItemService.updateSimfExamineItem(simfExamineItem));
    }

    /**
     * 删除审批记录
     */
    @PreAuthorize("@ss.hasPermi('examine:SimfExamineItem:remove')")
    @Log(title = "审批记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{itemIds}")
    public AjaxResult remove(@PathVariable Long[] itemIds)
    {
        return toAjax(simfExamineItemService.deleteSimfExamineItemByItemIds(itemIds));
    }
}
